package com.fezs.common.jackson;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JacksonStdImpl;
import com.fasterxml.jackson.databind.ser.std.DateSerializer;

import java.io.IOException;
import java.util.Date;

/**
 * @author zhukai
 * @since 2022/9/9
 */
@JacksonStdImpl
public class DateToLongSerializer extends DateSerializer {

    @Override
    public void serialize(Date value, JsonGenerator g, SerializerProvider provider) throws IOException {
        g.writeNumber(this._timestamp(value));
    }
}
